import request from '@/utils/request'
var group_name = 'user'
export default {
  getUserList(page) { 
    return request({
      url: `/${group_name}/userList`,
      method: 'post',
      data:page
    })
  },
  getRolesByUId(id) { 
    return request({
      url: `/${group_name}/getRolesByUId/${id}`,
      method: 'get'
    })
  },
  addUser(user) { 
    return request({
      url: `/${group_name}/addUser`,
      method: 'post',
      data: user
    })
  },
  deleteUser(id) { 
    return request({
      url: `/${group_name}/deleteUser/${id}`,
      method: 'delete'
    })
  },
  viewUser(id) { 
    return request({
      url: `/${group_name}/viewUser/${id}`,
      method: 'get'
    })
  },
  update(user) { 
    return request({
      url: `/${group_name}/update`,
      method: 'put',
      data: user
    })
  },
  addRoles(idList,id) { 
    return request({
      url: `/${group_name}/addRoles/${id}`,
      method: 'post',
      data: idList
    })
  },
  getByUserName(username) { 
    return request({
      url: `/${group_name}/getByUserName?username=`+username,
      method: 'get'
    })
  },
  getUserMenu(id) { 
    return request({
      url: `/${group_name}/getUserMenu/${id}`,
      method: 'get'
    })
  },
  getUserInfo() {
    return request({
      url: `/${group_name}/getUserInfo`,
      method: 'get'
    })
  },
  getAll(allCtrl) {
    return request({
      url: `/all`,
      method: 'post',
      data: allCtrl
    })
  },

}